package com.example.wanxiang.service.Impl;

import com.example.wanxiang.entity.Invite;
import com.example.wanxiang.repository.InviteRepository;
import com.example.wanxiang.service.InviteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("inviteService")
public class InviteServiceImpl implements InviteService {
    @Autowired
    private InviteRepository inviteRepository;

    @Override
    public Invite deleteInvite(String code) {
        Invite byCode = inviteRepository.findByCode(code);
        if (byCode != null)
        inviteRepository.delete(byCode);
        return byCode;
    }
}
